<?php
namespace app\api\controller;
header("Content-Type: text/html;charset=utf-8");
header('Access-Control-Allow-Origin:*');
use think\Controller;
use think\Db;
class Focus extends Controller
{
	public function club(){
		$uid=input('uid');
		$cid=input('cid');
		$date=['cid'=>$cid,
                'uid'=>$uid,
                 'ftime'=>date('Y-m-d H:i:s'),];
        $focusclub=Db::name('focus')->insert($date);
        if($focusclub){

        	return jsonp($focusclub);
        }else{
        	 return jsonp([
				                  'error'=>'0',
				                  'msg'=>'关注失败',
			                        ]);
        }
	}

	public function deleteclub(){
		$uid=input('uid');
		$cid=input('cid');
		$deleteclub=Db::name('focus')->where("uid='$uid' AND cid='$cid'")->find();
		if($deleteclub){

			if(Db::name('focus')->where("uid='$uid' AND cid='$cid'")->delete()){
				return jsonp([
				                  'status'=>'1',
				                  'msg'=>'取消关注成功',
			                        ]);
			}else{
				return jsonp([
				                  'status'=>'0',
				                  'msg'=>'取消关注失败',
			                        ]);
			}
			
		}else{
			  return jsonp([
				                  'error'=>'0',
				                  'msg'=>'未关注俱乐部',
			                        ]);
		}
	}

}